//
//  NSObject+LBHTTPSessionManager.h
//  LBNetworking
//
//  Created by WuShiHai on 19/5/30.
//  Copyright (c) 2019 Lebbay. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSObject (LBHTTPSessionManager)

/**
 添加task到任务栈里面，使其与调用的object进行捆绑

 @param task 任务参数
 */
- (void)addTask:(NSURLSessionTask *)task;
//use in dealloc.
/**
 取消所有的任务，use in dealloc.
 */
- (void)cancelAllTask;

/**
 移除对应的观察，use in dealloc.
 */
- (void)removeNSURLSessionTaskObserver;

/**
 获取当前object 中 调用的task数目

 @return 数目
 */
- (NSInteger)numberOfTasks;

/**
 所有任务完成后的回调

 @param completeHandle 回调
 */
- (void)tasksDidComplete:(void(^)(void))completeHandle;

@end
